#@layer()
#define script()
<script>

    $('.takeCoupon').on("click",function () {
        var couponId = $(this).attr("data-coupon-id");
        var userId = "#para('userid')";
        ajaxGet('#(CPATH)/admin/finance/coupon/doCodeSave?status=1&couponId='+couponId+'&userId='+userId);
        parent.layer.closeAll();
    });

</script>
#end

#define content()
    <section class="content">

        <div class="container-fluid">
                <!-- /.card-header -->
                <div class="card-body p-0">

                    <table class="table table-striped">
                        <tbody>
                        <tr>
                            <th style="width: 25%">名称</th>
                            <th style="width: 15%">类型</th>
                            <th style="width: 10%">金额</th>
                            <th style="width: 10%">发券量</th>
                            <th style="width: 10%">领取量</th>
                            <th style="width: 10%">使用量</th>
                            <th style="width: 10%">状态</th>
                            <th style="width: 10%">操作</th>
                        </tr>
                        #for(coupon : page.list ??)
                        <tr>
                            </td>
                            <td>
                                <strong>
                                    <a target="_blank" href="#(CPATH)/admin/finance/coupon/edit/#(coupon.id)"> #(coupon.title ??) </a>
                                </strong>
                                <div class="jp-action-card">
                                    <div class="jp-action-body">
                                    </div>
                                </div>
                            </td>
                            <td>#(coupon.typeStr ??)</td>
                            <td>#(coupon.amount ??)</td>
                            <td>#(coupon.quota ??)</td>
                            <td><a href="#(CPATH)/admin/finance/coupon/takes/#(coupon.id)">#(coupon.take_count ??)</a></td>
                            <td><a href="#(CPATH)/admin/finance/coupon/useds?coid=#(coupon.id)">#(coupon.used_count ??)</a></td>
                            <td>#(coupon.statusStr ??)</td>
                            <td>
                                <a href="javascript:;" class="takeCoupon" data-coupon-id="#(coupon.id)">分配</a>
                            </td>
                        </tr>
                        #end
                        </tbody>
                    </table>
                </div>
                <!-- /.card-body -->
                <div class="card-footer">
                    <div class="row">
                        <div class="col-sm-12">
                            #@_paginate()
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </section>
#end
